/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg1241316_webbrowser;

import WebBrowser_Cores.QuetThongTin;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Administrator
 */
public class ThreadQuet extends Thread
{
    String strURL;
    String strXPath;
    
    public ThreadQuet(String url, String XPath) {
        this.strURL = url;
        this.strXPath = XPath;
    }
     public void run()
     {
        try{
             URL yahoo = new URL(strURL);
        URLConnection yc = yahoo.openConnection();
            String strResult;
            try (BufferedReader in = new BufferedReader(
                                         new InputStreamReader(
                                         yc.getInputStream()))) {
                strResult = "";
                String inputLine="";
                while ((inputLine = in.readLine()) != null) 
                    strResult+=inputLine;
            }
        strResult = strResult.replaceAll(">", "> \r\n");
        
        //lấy mẫu tin từ đường link này dựa vào Xpath.
        String nodePart = FindNodePart(strXPath);
        QuetThongTin quet=new QuetThongTin(strResult);
        quet.ScanVNEXPRESS();
        }catch(Exception ex)
        {}
     }
/**
 * Lấy tên node cần lấy
 * @param strXPath
 * @return 
 */
    private String FindNodePart(String strXPath) {
    String strResult="";
    try{}catch(Exception ex){}
    return strResult;
    }
    
   
    
}
